<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
// API 模板文件，可以复制
namespace api\home\controller;

use think\Db;
use think\Request;
use think\Validate;
use cmf\controller\RestBaseController;
use api\home\controller\CompanyinfoController;
use api\resource\controller\Biao1Controller;
use api\resource\controller\Biao2Controller;
use api\resource\controller\Biao3Controller;
use api\resource\controller\Biao4Controller;
use api\resource\controller\Biao5Controller;
use api\resource\controller\Biao6Controller;
use api\resource\controller\Biao7Controller;
use api\resource\controller\Biao8Controller;
use api\resource\controller\Biao9Controller;
use api\resource\controller\Biao10Controller;
use api\resource\controller\Biao11Controller;
use api\resource\controller\Biao12Controller;
use api\resource\controller\Biao13Controller;
use api\resource\controller\Biao14Controller;
use api\resource\controller\Biao15Controller;
use api\resource\controller\Biao16Controller;
use api\resource\controller\Biao17Controller;
use api\resource\controller\Biao18Controller;
use api\resource\controller\Biao19Controller;
use api\resource\controller\Biao20Controller;
use api\resource\controller\Biao21Controller;
use api\resource\controller\Biao22Controller;
use api\resource\controller\Biao23Controller;
use api\resource\controller\Biao24Controller;
use api\resource\controller\Biao25Controller;
use api\resource\controller\Biao26Controller;
use api\resource\controller\Biao27Controller;
use api\resource\controller\Biao28Controller;
use api\resource\controller\Biao29Controller;
use api\resource\controller\Biao30Controller;
use api\resource\controller\Biao31Controller;
use api\resource\controller\Biao32Controller;
use api\resource\controller\Biao33Controller;
use api\resource\controller\Biao34Controller;
use api\resource\controller\Biao35Controller;
use api\resource\controller\Biao36Controller;
use api\resource\controller\Biao37Controller;
use api\resource\controller\Biao38Controller;
use api\resource\controller\Biao39Controller;
use api\resource\controller\Biao40Controller;
use api\resource\controller\Biao41Controller;
use api\resource\controller\Biao42Controller;
use api\resource\controller\Biao43Controller;
use api\resource\controller\Biao44Controller;
use api\resource\controller\Biao45Controller;
use api\resource\controller\TablesController;
use api\user\controller\SelectController;

class TableController extends RestBaseController
{
    public function index($pro_id, $biao_id)
    {
        /*
        $validate = new Validate([
            'pro_id'  => 'require',
            'biao_id' => 'require',
        ]);

        $validate->message([
            'pro_id.require'  => '请输入项目id!',
            'biao_id.require' => '请输入第几表!',
        ]);

        $data = $this->request->param();
        if (!$validate->check($data)) {
            $this->error($validate->getError());
        }
        */

        $new_data   = new TablesController();

        $table_data = $new_data->readSelf($pro_id,$biao_id);


        $biao = $biao_id;

        switch ($biao) {
            case 1:
                $new_biao = new Biao1Controller();
                break;
            case 2:
                $new_biao = new Biao2Controller();
                break;
            case 3:
                $new_biao = new Biao3Controller();
                break;
            case 4:
                $new_biao = new Biao4Controller();
                break;
            case 5:
                $new_biao = new Biao5Controller();
                break;
            case 6:
                $new_biao = new Biao6Controller();
                break;
            case 7:
                $new_biao = new Biao7Controller();
                break;
            case 8:
                $new_biao = new Biao8Controller();
                break;
            case 9:
                $new_biao = new Biao9Controller();
                break;
            case 10:
                $new_biao = new Biao10Controller();
                break;
            case 11:
                $new_biao = new Biao11Controller();
                break;
            case 12:
                $new_biao = new Biao12Controller();
                break;
            case 13:
                $new_biao = new Biao13Controller();
                break;
            case 14:
                $new_biao = new Biao14Controller();
                break;
            case 15:
                $new_biao = new Biao15Controller();
                break;
            case 16:
                $new_biao = new Biao16Controller();
                break;
            case 17:
                $new_biao = new Biao17Controller();
                break;
            case 18:
                $new_biao = new Biao18Controller();
                break;
            case 19:
                $new_biao = new Biao19Controller();
                break;
            case 20:
                $new_biao = new Biao20Controller();
                break;
            case 21:
                $new_biao = new Biao21Controller();
                break;
            case 22:
                $new_biao = new Biao22Controller();
                break;
            case 23:
                $new_biao = new Biao23Controller();
                break;
            case 24:
                $new_biao = new Biao24Controller();
                break;
            case 25:
                $new_biao = new Biao25Controller();
                break;
            case 26:
                $new_biao = new Biao26Controller();
                break;
            case 27:
                $new_biao = new Biao27Controller();
                break;
            case 28:
                $new_biao = new Biao28Controller();
                break;
            case 29:
                $new_biao = new Biao29Controller();
                break;
            case 30:
                $new_biao = new Biao30Controller();
                break;
            case 31:
                $new_biao = new Biao31Controller();
                break;
            case 32:
                $new_biao = new Biao32Controller();
                break;
            case 33:
                $new_biao = new Biao33Controller();
                break;
            case 34:
                $new_biao = new Biao34Controller();
                break;
            case 35:
                $new_biao = new Biao35Controller();
                break;
            case 36:
                $new_biao = new Biao36Controller();
                break;
            case 37:
                $new_biao = new Biao37Controller();
                break;
            case 38:
                $new_biao = new Biao38Controller();
                break;
            case 39:
                $new_biao = new Biao39Controller();
                break;
            case 40:
                $new_biao = new Biao40Controller();
                break;
            case 41:
                $new_biao = new Biao41Controller();
                break;
            case 42:
                $new_biao = new Biao42Controller();
                break;
            case 43:
                $new_biao = new Biao43Controller();
                break;
            case 44:
                $new_biao = new Biao44Controller();
                break;
            case 45:
                $new_biao = new Biao45Controller();
                break;
            default:
                // code...
                break;
        }


        $html = $new_biao->one($table_data);


        return $html;


    }

    public function one($project_id)
    {

        //查 这个表的数据
        $companyinfo   = new CompanyinfoController();
        $register_data = $companyinfo->register($project_id, $private = 1);


        // 查出 类型表
        $select      = new SelectController();
        $select_data = $select->getRegisterSelect($private = 1);
//        return $register_data;


        foreach ($select_data['register_foreign'] as $v) {
            if ($v['id'] == $register_data["foreign_id"]) {
                $register_data["foreign_id"] = $v['name'];
            }
        }

        foreach ($select_data['register_industry'] as $v) {
            if ($v['id'] == $register_data["industry_id"]) {
                $register_data["industry_id"] = $v['name'];
            }
        }

        foreach ($select_data['register_scale'] as $v) {
            if ($v['id'] == $register_data["scale_id"]) {
                $register_data["scale_id"] = $v['name'];
            }
        }

        foreach ($select_data['register_revenue'] as $v) {
            if ($v['id'] == $register_data["revenue_id"]) {
                $register_data["revenue_id"] = $v['name'];
            }
        }

        foreach ($select_data['register_colllection'] as $v) {
            if ($v['id'] == $register_data["colllection_id"]) {
                $register_data["colllection_id"] = $v['name'];
            }
        }

        //查出 register_civics_type表的 分表id
        $new_civics_type_data = [];
        foreach ($select_data['register_civics_type'] as $v) {
            $new_civics_type_data[$v['id']] = $v['name'];
        }


        //查出 register_stock_legal表的 分表id
        $new_legal_type_data = [];
        foreach ($select_data['register_legal_type'] as $v) {
            $new_legal_type_data[$v['id']] = $v['name'];
        }

        $register_data["marketing"]          = $register_data["marketing"] ? "是" : "否";
        $register_data["high_tech"]          = $register_data["high_tech"] ? "是" : "否";
        $register_data["venture_investment"] = $register_data["venture_investment"] ? "是" : "否";

        $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
        <tbody>
            <tr>
                <td class="tr">企业名称：</td>
                <td colspan="2" class="df">
                    ' . $register_data["company_name"] . '
                </td>
                <td class="tr">注册时间：</td>
                <td class="df">
                    ' . $register_data["register_time"] . '
                </td>
                <td class="tr">已成立年限</td>
                <td class="df">
                    ' . $register_data["founding_year"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">主营产品（服务）所属技术领域：</td>
                <td colspan="2" class="df">
                    <a download href=' . @$register_data["product"]->url . '> ' . @$register_data["product"]->filename . '</a>
                </td>
                <td class="tr">注册类型：</td>
                <td class="df">
                     <a download href=' . @$register_data["register_type"]->url . '> ' . @$register_data["register_type"]->filename . '</a>
                </td>
                <td class="tr">外资国别：</td>
                <td class="df">
                    ' . $register_data["foreign_id"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">注册资金（万元）：</td>
                <td colspan="2" class="df">
                    ' . $register_data["register_money"] . '
                </td>
                <td class="tr">所属行业：</td>
                <td colspan="3" class="df">
                     ' . $register_data["industry_id"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">企业规模：</td>
                <td colspan="2" class="df">
                    ' . $register_data["scale_id"] . '
                </td>
                <td class="tr">行政区域：</td>
                <td colspan="3" class="df">
                    ' . $register_data["area"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">企业所得税主管税务机关：</td>
                <td colspan="2" class="df">
                    ' . $register_data["revenue_id"] . '
                </td>
                <td class="tr">企业所得税征收方式：</td>
                <td colspan="3" class="df">
                    ' . $register_data["colllection_id"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">组织机构代码/统一信用社会代码：</td>
                <td colspan="2" class="df">
                    ' . $register_data["credit_code"] . '
                </td>
                <td class="tr">税务登记号/统一社会信用代码：</td>
                <td colspan="3" class="df">
                    ' . $register_data["revenue_code"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">通信地址：</td>
                <td colspan="4" class="df">
                    ' . $register_data["mailing_address"] . '
                </td>
                <td class="tr">邮政编码：</td>
                <td class="df">
                    ' . $register_data["postcode"] . '
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">企业法定代表人：</td>
                <td class="tr">姓名：</td>
                <td class="df">
                    ' . $register_data["legal_name"] . '
                </td>
                <td class="tr">手机：</td>
                <td class="df">
                    ' . $register_data["legal_phone"] . '
                </td>
                <td class="tr">证件号码：</td>
                <td class="df">
                    ' . $register_data["legal_documents"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">电话：</td>
                <td class="df">
                    ' . $register_data["legal_tel"] . '
                </td>
                <td class="tr">传真：</td>
                <td class="df">
                    ' . $register_data["legal_fax"] . '
                </td>
                <td class="tr">E-mail：</td>
                <td class="df">
                    ' . $register_data["legal_email"] . '
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">联系人：</td>
                <td class="tr">姓名：</td>
                <td class="df">
                     ' . $register_data["linkman_name"] . '
                </td>
                <td class="tr">手机：</td>
                <td class="df">
                    ' . $register_data["linkman_phone"] . '
                </td>
                <td colspan="2" class="tr"></td>
            </tr>
            <tr>
                <td class="tr">电话：</td>
                <td class="df">
                    ' . $register_data["linkman_tel"] . '
                </td>
                <td class="tr">传真：</td>
                <td class="df">
                    ' . $register_data["linkman_fax"] . '
                </td>
                <td class="tr">E-mail：</td>
                <td class="df">
                     ' . $register_data["linkman_email"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">企业是否上市：</td>
                <td colspan="6" class="df">
                    ' . $register_data["marketing"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">是否属于国家级高新区内企业：</td>
                <td colspan="6" class="df">
                     ' . $register_data["high_tech"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">是否引入风险投资：</td>
                <td colspan="6" class="df">
                     ' . $register_data["venture_investment"] . '
                </td>
            </tr>
            <tr>
                <td colspan="7">股权结构（可选择填写前10名主要股东）</td>
            </tr>
            <tr>
                <td width="20%">序号</td>
                <td width="20%">公民类型</td>
                <td width="20%">姓名</td>
                <td width="20%" colspan="3">身份证（护照）号</td>
                <td width="20%" class="df">投资额（万元）</td>
            </tr>';

        if (empty($register_data['register_stock_civics'])) {
            $html .= '<tr>
                    <td colspan="7" style="text-align: center;">暂无数据</td>
                </tr>';
        } else {
            foreach ($register_data['register_stock_civics'] as $k => $v) {
                $k++;
                $html .= '<tr>
                    <td width="20%" >' . $k . '</td>
                    <td width="20%" >' . $new_civics_type_data[$v["civics_type_id"]] . '</td>
                    <td width="20%" >' . $v["stock_name"] . '</td>
                    <td  width="20%" colspan="3" >' . $v["stock_num"] . '</td>
                    <td  width="20%" class="df" >' . $v["stock_investment"] . '</td>
                </tr>';
            }
        }


        $html .= '<tr>
                <td width="20%">序号</td>
                <td width="20%">法人类型</td>
                <td width="20%">名称</td>
                <td width="20%" colspan="3">法人代码</td>
                <td width="20%" class="df">投资额（万元）</td>
            </tr>';

        if (empty($register_data['register_stock_legal'])) {
            $html .= '<tr>
                    <td colspan="7" style="text-align: center;">暂无数据</td>
                </tr>';
        } else {
            foreach ($register_data['register_stock_legal'] as $k => $v) {
                $k++;
                $html .= '<tr>
                    <td width="20%" >' . $k . '</td>
                    <td width="20%" >' . $new_legal_type_data[$v["legal_type_id"]] . '</td>
                    <td width="20%" >' . $v["stock_legal_name"] . '</td>
                    <td width="20%" colspan="3">' . $v["stock_legal_num"] . '</td>
                    <td width="20%" class="df" >' . $v["stock_legal_investment"] . '</td>
                </tr>';
            }
        }
        $html .= '</tbody>
                    </table>';
        return $html;

    }

    public function two($project_id)
    {
        //查 这个表的数据
        $companyinfo    = new CompanyinfoController();
        $condition_data = $companyinfo->condition($project_id, $private = 1);

        $condition_data["rename"]    = $condition_data["rename"] ? "是" : "否";
        $condition_data["high_tech"] = $condition_data["high_tech"] ? "是" : "否";


        $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
        <tbody>
            <tr>
                <td class="tr">企业名称：</td>
                <td colspan="5" class="df">
                     ' . $condition_data["company_name"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">单位近期是否更名：</td>
                <td colspan="5" class="df">
                ' . $condition_data["rename"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">是否高新区内企业：</td>
                <td colspan="2" class="df">
                ' . $condition_data["high_tech"] . '
                </td>
                <td class="tr">所属高新区名称：</td>
                <td colspan="2" class="df">
                     ' . $condition_data["high_tech_name"] . '
                </td>
            </tr>
            <tr>
                <td class="tr">主营产品（服务）所属技术领域：</td>
                <td colspan="2" class="df">
                ' . $condition_data["main_product"] . '
                </td>
                <td class="tr">次营产品（服务）所属技术领域：</td>
                <td colspan="2" class="df">
                ' . $condition_data["company_product"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">企业注册号/填报号：</td>
                <td colspan="5" class="df">
                ' . $condition_data["company_register_num"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">填报日期：</td>
                <td colspan="5" class="df">
                ' . $condition_data["reported_time"] . '

                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">获得知识产权数量（件）：</td>
                <td class="tr">获得I类知识产权数量（件）：</td>
                <td colspan="4" class="df">
                ' . $condition_data["one_num"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">获得II类知识产权数量（件）：</td>
                <td colspan="4" class="df">
                ' . $condition_data["two_num"] . '

                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">人力资源情况（人）：</td>
                <td class="tr">职工总数（人）：</td>
                <td colspan="2" class="df">
                ' . $condition_data["staff_num"] . '

                </td>
                <td class="tr">从事研发和相关技术创新活动的科技人员率（人）：</td>
                <td class="df">
                ' . $condition_data["research_num"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">科技人员占比（%）：</td>
                <td colspan="4" class="df">
                ' . $condition_data["scientists_proportion"] . '

                </td>
            </tr>
            <tr>
                <td rowspan="4" class="tr">近三年经营情况（万元）：</td>
                <td class="tcenter">年度/种类</td>
                <td class="tcenter">净资产（万元）</td>
                <td colspan="2" class="tcenter">营销收入（万元）</td>
                <td class="tcenter">利润总额（万元）</td>
            </tr>
            <tr>
                <td class="tcenter df">
                                    ' . $condition_data["three_year"] . '

                </td>
                <td class="tcenter df">
                                    ' . $condition_data["three_year_asset"] . '

                </td>
                <td colspan="2" class="tcenter df">
                                    ' . $condition_data["three_year_income"] . '

                </td>
                <td class="tcenter df">
                                    ' . $condition_data["three_year_profit"] . '

                </td>
            </tr>
            <tr>
                <td class="tcenter df">
                                      ' . $condition_data["two_year"] . '

                </td>
                <td class="tcenter df">
                                      ' . $condition_data["two_year_asset"] . '

                </td>
                <td colspan="2" class="tcenter df">
                                      ' . $condition_data["two_year_income"] . '

                </td>
                <td class="tcenter df">
                                      ' . $condition_data["two_year_profit"] . '

                </td>
            </tr>
            <tr>
                <td class="tcenter df">
                ' . $condition_data["one_year"] . '
                </td>
                <td class="tcenter df">
                ' . $condition_data["one_year_asset"] . '

                </td>
                <td colspan="2" class="tcenter df">
                ' . $condition_data["one_year_income"] . '

                </td>
                <td class="tcenter df">
                ' . $condition_data["one_year_profit"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">近一年企业总收入（万元）：</td>
                <td colspan="2" class="df">
                 ' . $condition_data["general_income"] . '

                </td>
                <td class="tr">近一年高新技术产品（服务）收入（万元）：</td>
                <td colspan="2" class="df">
                 ' . $condition_data["product_income"] . '
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">近三年研究开发费用（万元）：</td>
                <td colspan="2" rowspan="2" class="df">
                ' . $condition_data["past_three_year_income"] . '

                </td>
                <td rowspan="2" class="tr">其中：</td>
                <td class="tr">在中国境内研发费用总额（万元）：</td>
                <td class="df">
                 ' . $condition_data["past_three_year_china_income"] . '

                </td>
            </tr>
            <tr>
                <td class="tr">基础研究投入费用总额（万元）：</td>
                <td class="df">
                 ' . $condition_data["past_three_year_basics_income"] . '

                </td>
            </tr>
            <tr>
                <td colspan="3" class="tr">申请认定前一年内是否都发生过重大安全、重大质量事故或严重环境违法行为：</td>
                <td colspan="3" class="df">
                ' . $condition_data["unlawful_act"] . '
                </td>
            </tr>
        </tbody>
    </table>';

        return $html;


    }

    public function three($project_id)
    {
        //查 这个表的数据
        $companyinfo    = new CompanyinfoController();
        $knowledge_data = $companyinfo->knowledge($project_id, $private = 1);

        // 查出 类型表
        $select      = new SelectController();
        $select_data = $select->getKnowledgeSelect($private = 1);


        //查出 register_civics_type表的 分表id
        $new_info_type_data = [];
        foreach ($select_data['knowledge_info_type'] as $v) {
            $new_info_type_data[$v['id']] = $v['name'];
        }


        //查出 register_stock_legal表的 分表id
        $new_condition_level_data = [];
        foreach ($select_data['knowledge_condition_level'] as $v) {
            $new_condition_level_data[$v['id']] = $v['name'];
        }

        $intellectual_property_status = ['否', '是'];

        $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
        <tbody>
            <tr>
                <td rowspan="6" class="tr">获得知识产权数量（件）：</td>
                <td rowspan="4" class="tr">
                    获得I类知识产权数量（件）：
                </td>
                <td class="tr">发明专利：</td>
                <td class="df" colspan="3">
                    <div><a download href=' . @$knowledge_data['one_invent_patent']->url . '>' . @$knowledge_data['one_invent_patent']->filename . '</a></div>
                </td>
                <td class="tr">其中：国防专利：</td>
                <td class="df" colspan="2">
                                        <div><a download href=' . @$knowledge_data['one_defence_variety']->url . '>' . @$knowledge_data['one_defence_variety']->filename . '</a></div>

                </td>
            </tr>
            <tr>
                <td class="tr">植物新品种：</td>
                <td class="df" colspan="3">
                    <div><a download href=' . @$knowledge_data['one_plant_variety']->url . '>' . @$knowledge_data['one_plant_variety']->filename . '</a></div>

                </td>
                <td class="tr">国家一级中药保护品种：</td>
                <td class="df" colspan="2">
                    <div><a download href=' . @$knowledge_data['one_medicine_variety']->url . '>' . @$knowledge_data['one_medicine_variety']->filename . '</a></div>

                </td>
            </tr>
            <tr>
                <td class="tr">经审定的国家级农作物品种：</td>
                <td class="df" colspan="3">
                    <div><a download href=' . @$knowledge_data['one_crop_variety']->url . '>' . @$knowledge_data['one_crop_variety']->filename . '</a></div>

                </td>
                <td class="tr">国家新药：</td>
                <td class="df" colspan="2">
                    <div><a download href=' . @$knowledge_data['one_new_medicine']->url . '>' . @$knowledge_data['one_new_medicine']->filename . '</a></div>

                </td>
            </tr>
            <tr>
                <td class="tr">集成电路布图设计：</td>
                <td colspan="6" class="df">
                    <div><a download href=' . @$knowledge_data['one_circuit_design']->url . '>' . @$knowledge_data['one_circuit_design']->filename . '</a></div>
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="tr">
                    获得II类知识产权数量（件）：
                </td>
                <td class="tr">国内使用新型专利：</td>
                <td class="df" colspan="3">
                    <div>
                    ' . $knowledge_data['two_attility_patent'] . '
                    </div>
                </td>
                <td class="tr">软件著作权：</td>
                <td class="df" colspan="2">
                    <div><a download=""></a></div>
                </td>
            </tr>
            <tr>
                <td class="tr">外观专利：</td>
                <td colspan="6" class="df">
                    <div><a download href=' . @$knowledge_data['two_facade_variety']->url . '>' . @$knowledge_data['two_facade_variety']->filename . '</a></div>
                </td>
            </tr>
            <tr>
                <td>序号</td>
                <td>知识产权编号</td>
                <td>知识产权名称</td>
                <td>类别</td>
                <td>授权日期</td>
                <td>授权号</td>
                <td>获取方式</td>
                <td>是否为有效知识产权</td>
                <td>
                    <div>操作</div>
                </td>
            </tr>';


        if (empty($knowledge_data['knowledge_info'])) {
            $html .= '<tr>
                    <td colspan="9" style="text-align: center;">暂无数据</td>
                </tr>';
        } else {
            foreach ($knowledge_data['knowledge_info'] as $k => $v) {
                $k++;
                $html .= '<tr>
                    <td width="20%" >' . $k . '</td>
                    <td width="20%" >' . $v["intellectual_property_number"] . '</td>
                    <td width="20%" >' . $v["intellectual_property_name"] . '</td>
                    <td  width="20%"  >' . $new_info_type_data[$v["knowledge_info_type_id"]] . '</td>
                    <td  width="20%"  >' . $v["privileged_time"] . '</td>
                    <td  width="20%"  >' . $v["privileged_num"] . '</td>
                    <td  width="20%"  >' . $v["access"] . '</td>
                    <td  width="20%"  >' . $intellectual_property_status[$v["intellectual_property_status"]] . '</td>
                    <td  width="20%"  ><a download href=' . @$v['info_accessory']->url . '>' . @$v['info_accessory']->filename . '</a></td>
                </tr>';
            }
        }


        $html .= '<tr>
                <td colspan="3">有效知识产权合计数：</td>
                <td class="df" colspan="6">
                    ' . $knowledge_data['intellectual_property_num'] . '
                </td>
            </tr>';

        $html .= '<tr>
                <td colspan="9">企业参与国家标准或行业标准制定情况汇总表（加分项）</td>
            </tr>
            <tr>
                <td>序号</td>
                <td>标准名称</td>
                <td>标准级别</td>
                <td>标准编号</td>
                <td>标准颁布时间</td>
                <td>参与方式</td>
                <td colspan="2">
                    操作
                </td>
            </tr>';

        if (empty($knowledge_data['knowledge_condition'])) {
            $html .= '<tr>
                    <td colspan="9" style="text-align: center;">暂无数据</td>
                </tr>';
        } else {
            foreach ($knowledge_data['knowledge_condition'] as $k => $v) {
                $k++;
                $html .= '<tr>
                    <td width="20%" >' . $k . '</td>
                    <td width="20%" >' . $v["standard_name"] . '</td>
                    <td width="20%" >' . $new_condition_level_data[$v["standard_level_id"]] . '</td>
                    <td  width="20%"  >' . $v["standard_num"] . '</td>
                    <td  width="20%"  >' . $v["standard_time"] . '</td>
                    <td  width="20%"  >' . $v["participation_way"] . '</td>
                    <td  width="40%"  colspan="2"><a download href=' . @$v['condition_accessory']->url . '>' . @$v['condition_accessory']->filename . '</a></td>
                </tr>';
            }
        }

        $html .= '</tbody></table>';


        return $html;
    }

    /**
     * 人力资源情况表
     */
    public function four($project_id)
    {
        //获取七牛云域名
        $domain = $this->getDomain();

        //根据项目ID查询人力资源情况表信息
        $human = Db::name("pro_human")->where('pro_id', $project_id)->find();

        if (!empty($human)) {
            //如果人力资源情况表信息不为空
            $human['number'] = json_decode($human['number']);
            $human['reason'] = unserialize($human['reason']);

            //拼接字符串
            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
            <tbody>
                <tr>
                    <td colspan="5">（一）总体情况</td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2">企业职工</td>
                    <td colspan="2">科技人员</td>
                </tr>
                <tr>
                    <td>总数（人）</td>
                    <td colspan="2">
                        ' . $human['number']->esum . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->ssum . '
                    </td>
                </tr>
                <tr>
                    <td>其中：在职人员</td>
                    <td colspan="2">
                        ' . $human['number']->einService . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->sinService . '
                    </td>
                </tr>
                <tr>
                    <td>兼职人员</td>
                    <td colspan="2">
                        ' . $human['number']->epartTime . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->spartTime . '
                    </td>
                </tr>
                <tr>
                    <td>临时聘用人员</td>
                    <td colspan="2">
                        ' . $human['number']->etemporary . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->stemporary . '
                    </td>
                </tr>
                <tr>
                    <td>外籍人员</td>
                    <td colspan="2">
                        ' . $human['number']->eforeignNationality . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->sforeignNationality . '
                    </td>
                </tr>
                <tr>
                    <td>留学归国人数</td>
                    <td colspan="2">
                        ' . $human['number']->ehomecoming . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->shomecoming . '
                    </td>
                </tr>
                <tr>
                    <td>国家科技将人员</td>
                    <td colspan="2">
                        ' . $human['number']->estate . '
                    </td>
                    <td colspan="2">
                        ' . $human['number']->sstate . '
                    </td>
                </tr>
                <tr>
                    <td colspan="5">（二）人员结构</td>
                </tr>
                <tr>
                    <td>学历</td>
                    <td>博士</td>
                    <td>硕士</td>
                    <td>本科</td>
                    <td>大专及以下</td>
                </tr>
                <tr>
                    <td>人数</td>
                    <td>
                        ' . $human['number']->doctor . '
                    </td>
                    <td>
                        ' . $human['number']->master . '
                    </td>
                    <td>
                        ' . $human['number']->undergraduate . '
                    </td>
                    <td>
                        ' . $human['number']->academy . '
                    </td>
                </tr>
                <tr>
                    <td>职称</td>
                    <td>高级职称</td>
                    <td>中级职称</td>
                    <td>低级职称</td>
                    <td>高级技工</td>
                </tr>
                <tr>
                    <td>人数</td>
                    <td>
                        ' . $human['number']->high . '
                    </td>
                    <td>
                        ' . $human['number']->center . '
                    </td>
                    <td>
                        ' . $human['number']->low . '
                    </td>
                    <td>
                        ' . $human['number']->highSenior . '
                    </td>
                </tr>
                <tr>
                    <td>年龄</td>
                    <td>30及以下</td>
                    <td>31-40</td>
                    <td>41-50</td>
                    <td>51以上</td>
                </tr>
                <tr>
                    <td>人数</td>
                    <td>
                        ' . $human['number']->age30 . '
                    </td>
                    <td>
                        ' . $human['number']->age40 . '
                    </td>
                    <td>
                        ' . $human['number']->age50 . '
                    </td>
                    <td>
                        ' . $human['number']->agetop . '
                    </td>
                </tr>
                <tr>
                    <td colspan="5">（三）企业部分月份月平均职工总数情况</td>
                </tr>
                <tr style="text-align:center;">
                    <td>1月份</td>
                    <td>3月份</td>
                    <td>9月份</td>
                    <td>12月份</td>
                    <td>平均数</td>
                </tr>
                <tr style="text-align:center;">
                    <td>
                        ' . $human['number']->month1 . '
                    </td>
                    <td>
                        ' . $human['number']->month3 . '
                    </td>
                    <td>
                        ' . $human['number']->month9 . '
                    </td>
                    <td>
                        ' . $human['number']->month12 . '
                    </td>
                    <td>
                        ' . $human['number']->monthmean . '
                    </td>
                </tr>
                <tr>
                    <td colspan="5">所报职工总数与企业以上4个月平均职工不一致的原因：' . $human['reason'] . '</td>
                </tr>
                <tr>
                    <td colspan="5">佐证材料</td>
                </tr>
                <tr>
                    <td>序号</td>
                    <td colspan="2">附件名称</td>
                    <td>上传日期</td>
                    <td>
                        操作
                    </td>
                </tr>';

            //查询附件
            $humanFile = Db::name("human_proof")->where('pro_human_id', $human['h_id'])->select()->toArray();

            if (!empty($humanFile)) {
                foreach ($humanFile as $k => $value) {
                    $k++;
                    $html .= '<tr>
                                <td>' . $k . '</td>
                                <td colspan="2">' . $value['file_name'] . '</td>
                                <td>' . date('Y-m-d H:i:s', $value['add_time']) . '</td>
                                <td><a download href=' . $domain . $value['file'] . '>' . $value['file_name'] . '</a></td>
                            </tr>';
                }
            } else {
                $html .= '<tr><td colspan="5" style="text-align: center;">暂无附件</td></tr>';
            }

            $html .= '</tbody></table>';

        } else {
            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
                <tbody>
                    <tr>
                        <td colspan="5">（一）总体情况</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td colspan="2">企业职工</td>
                        <td colspan="2">科技人员</td>
                    </tr>
                    <tr>
                        <td>总数（人）</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>其中：在职人员</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>兼职人员</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>临时聘用人员</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>外籍人员</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>留学归国人数</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td>国家科技将人员</td>
                        <td colspan="2">
        
                        </td>
                        <td colspan="2">
        
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5">（二）人员结构</td>
                    </tr>
                    <tr>
                        <td>学历</td>
                        <td>博士</td>
                        <td>硕士</td>
                        <td>本科</td>
                        <td>大专及以下</td>
                    </tr>
                    <tr>
                        <td>人数</td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                    </tr>
                    <tr>
                        <td>职称</td>
                        <td>高级职称</td>
                        <td>中级职称</td>
                        <td>低级职称</td>
                        <td>高级技工</td>
                    </tr>
                    <tr>
                        <td>人数</td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                    </tr>
                    <tr>
                        <td>年龄</td>
                        <td>30及以下</td>
                        <td>31-40</td>
                        <td>41-50</td>
                        <td>51以上</td>
                    </tr>
                    <tr>
                        <td>人数</td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5">（三）企业部分月份月平均职工总数情况</td>
                    </tr>
                    <tr style="text-align:center;">
                        <td>1月份</td>
                        <td>3月份</td>
                        <td>9月份</td>
                        <td>12月份</td>
                        <td>平均数</td>
                    </tr>
                    <tr style="text-align:center;">
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                        <td>
        
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5">所报职工总数与企业以上4个月平均职工不一致的原因：</td>
                    </tr>
                    <tr>
                        <td colspan="5">佐证材料</td>
                    </tr>
                    <tr>
                        <td>序号</td>
                        <td colspan="2">附件名称</td>
                        <td>上传日期</td>
                        <td>
                            操作
                        </td>
                    </tr>
                    <tr>
                        <td colspan="5" style="text-align: center;">暂无附件</td>
                    </tr>
                </tbody>
            </table>';
        }

        return $html;
    }

    /**
     * 企业成长性情况表
     */
    public function five($project_id)
    {
        //获取七牛云域名
        $domain = $this->getDomain();

        $growth = Db::name("pro_growth")->where('pro_id', $project_id)->find();

        if (!empty($growth)) {

            $growth['assets'] = json_decode($growth['assets']);

            //拼接字符串
            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
                        <tbody>
                            <tr>
                                <td>年度</td>
                                <td width="20%" class="tcenter">净资产（万元）</td>
                                <td width="20%" class="tcenter">销售收入（万元）</td>
                                <td width="20%" class="tcenter">利润（万元）</td>
                                <td width="20%" class="tcenter">企业所得税实际纳税额（万元）</td>
                            </tr>
                            <tr>
                                <td class="tcenter">第1年</td>
                                <td>
                                    ' . $growth['assets']->onet . '
                                </td>
                                <td>
                                    ' . $growth['assets']->tnet . '
                                </td>
                                <td>
                                    ' . $growth['assets']->thnet . '
                                </td>
                                <td>
                                    ' . $growth['assets']->oincometax . '
                                </td>
                            </tr>
                            <tr>
                                <td class="tcenter">第2年</td>
                                <td>
                                    ' . $growth['assets']->osale . '
                                </td>
                                <td>
                                    ' . $growth['assets']->tsale . '
                                </td>
                                <td>
                                    ' . $growth['assets']->thsale . '
                                </td>
                                <td>
                                    ' . $growth['assets']->tincometax . '
                                </td>
                            </tr>
                            <tr>
                                <td class="tcenter">第3年</td>
                                <td>
                                    ' . $growth['assets']->oprofit . '
                                </td>
                                <td>
                                    ' . $growth['assets']->tprofit . '
                                </td>
                                <td>
                                    ' . $growth['assets']->thprofit . '
                                </td>
                                <td>
                                    ' . $growth['assets']->thincometax . '
                                </td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    增长率（%）' . $growth['assets']->ratenet . '
                                </td>
                                <td>
                                    增长率（%）' . $growth['assets']->ratesale . '
                                </td>
                                <td>
                                    年平均利润率（%）' . $growth['assets']->rateprofit . '
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td class="tr">上一年度应纳税所得额（万元）：</td>
                                <td colspan="4">
                                    ' . $growth['assets']->lastyearincome . '
                                </td>
                            </tr>
                            <tr class="tcenter">
                                <td>上一年度总收入（万元）</td>
                                <td colspan="2">收入总额（万元）</td>
                                <td colspan="2">不征税收入（万元）</td>
                            </tr>
                            <tr class="tcenter">
                                <td>
                                    ' . $growth['assets']->revenue . '
                                </td>
                                <td colspan="2">
                                    ' . $growth['assets']->totalincome . '
                                </td>
                                <td colspan="2">
                                    ' . $growth['assets']->noxtaxbleincome . '
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5">附件</td>
                            </tr>
                            <tr>
                                <td>序号</td>
                                <td>附件类型</td>
                                <td>附件名称</td>
                                <td>上传日期</td>
                                <td>
                                    操作
                                </td>
                            </tr>';

            //查询附件
            $growthFile = Db::name("growth_proof")
                ->alias('g')
                ->join('__PRO_ANNEX_TYPE__ t', 'g.file_type_id = t.t_id')
                ->field('g.*, t.type_name, t.t_id')
                ->where('pro_growth_id', $growth['g_id'])
                ->select()
                ->toArray();

            if (!empty($growthFile)) {
                foreach ($growthFile as $k => $val) {
                    $k++;
                    $html .= '<tr>
                                <td>' . $k . '</td>
                                <td>' . $val['type_name'] . '</td>
                                <td>' . $val['file_name'] . '</td>
                                <td>' . date('Y-m-d H:i:s', $val['add_time']) . '</td>
                                <td><a download href=' . $domain . $val['file'] . '>' . $val['file_name'] . '</a></td>
                            </tr>';
                }

            } else {
                $html .= '<tr><td colspan="5" style="text-align: center;">暂无数据</td></tr>';
            }

            $html .= '</tbody></table>';

        } else {
            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
                    <tbody>
                        <tr>
                            <td>年度</td>
                            <td width="20%" class="tcenter">净资产（万元）</td>
                            <td width="20%" class="tcenter">销售收入（万元）</td>
                            <td width="20%" class="tcenter">利润（万元）</td>
                            <td width="20%" class="tcenter">企业所得税实际纳税额（万元）</td>
                        </tr>
                        <tr>
                            <td class="tcenter">第1年</td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                        </tr>
                        <tr>
                            <td class="tcenter">第2年</td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                        </tr>
                        <tr>
                            <td class="tcenter">第3年</td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                            <td>
            
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                增长率（%）
                            </td>
                            <td>
                                增长率（%）
                            </td>
                            <td>
                                年平均利润率（%）
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td class="tr">上一年度应纳税所得额（万元）：</td>
                            <td colspan="4">
                                年平均利润率（%）
                            </td>
                        </tr>
                        <tr class="tcenter">
                            <td>上一年度总收入（万元）</td>
                            <td colspan="2">收入总额（万元）</td>
                            <td colspan="2">不征税收入（万元）</td>
                        </tr>
                        <tr class="tcenter">
                            <td>
                                年平均利润率（%）
                            </td>
                            <td colspan="2">
                                年平均利润率（%）
                            </td>
                            <td colspan="2">
                                年平均利润率（%）
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5">附件</td>
                        </tr>
                        <tr>
                            <td>序号</td>
                            <td>附件类型</td>
                            <td>附件名称</td>
                            <td>上传日期</td>
                            <td>
                                操作
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5" style="text-align: center;">暂无数据</td>
                        </tr>
                    </tbody>
                </table>';

        }

        return $html;
    }

    /**
     * 附件清单表
     */
    public function six($project_id)
    {
        //获取七牛云域名
        $domain = $this->getDomain();

        $annex = Db::name("pro_annex")
            ->alias('a')
            ->join('__PRO_ANNEX_TYPE__ t', 'a.annex_type_id = t.t_id')
            ->field('a.*, t.type_name, t.t_id')
            ->where('pro_id', $project_id)
            ->select()
            ->toArray();

        if (!empty($annex)) {
            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
                        <tbody>
                            <tr>
                                <td colspan="6">附件清单</td>
                            </tr>
                            <tr>
                                <td>序号</td>
                                <td>附件类型</td>
                                <td>附件名称</td>
                                <td>附件说明</td>
                                <td>上传日期</td>
                                <td class="df">
                                    操作
                                </td>
                            </tr>';
            foreach ($annex as $k => $v) {
                $k++;
                $html .= '<tr>
                            <td>' . $k . '</td>
                            <td>' . $v['type_name'] . '</td>
                            <td>' . $v['a_annex_name'] . '</td>
                            <td>' . $v['annex_description'] . '</td>
                            <td>' . date('Y-m-d H:i:s', $v['a_annex_time']) . '</td>
                            <td class="df"><a download href=' . $domain . $v['a_annex_file'] . '>' . $v['a_annex_filename'] . '</a></td>
                        </tr>';
            }

            $html .= '</tbody></table>';

        } else {

            $html = '<table border="1" style="width: 1200px;margin: 0 auto;white-space: nowrap;" cellspacing="0">
                        <tbody>
                            <tr>
                                <td colspan="6">附件清单</td>
                            </tr>
                            <tr>
                                <td>序号</td>
                                <td>附件类型</td>
                                <td>附件名称</td>
                                <td>附件说明</td>
                                <td>上传日期</td>
                                <td class="df">
                                    操作
                                </td>
                            </tr>
                            <tr class="tc">
                                <td colspan="6" style="text-align: center;">暂无数据</td>
                            </tr>
                        </tbody>
                    </table>';
        }

        return $html;
    }

}
